// main.js
import { createApp } from 'vue';
import { createPinia } from 'pinia';
import App from './App.vue';
import store from './store';
import * as api from './api'; 

// 工具函数
import storage from '@/utils/storage.js';
import validate from '@/utils/validate.js';
import date from '@/utils/date.js';
// ucharts图表
import uCharts from '@qiun/ucharts';

const app = createApp(App);
const pinia = createPinia();

if (typeof uni !== 'undefined') {
    uni.$api = api;  
    uni.$storage = storage;
    uni.$validate = validate;
    uni.$date = date;
    uni.$uCharts = uCharts;
}

app.config.globalProperties.$uCharts = uCharts;
app.config.globalProperties.$api = api; 
app.config.globalProperties.$storage = storage;
app.config.globalProperties.$validate = validate;
app.config.globalProperties.$date = date;

app.use(pinia);
app.use(store);
app.mount('#app');